import { makeAutoObservable } from "mobx";
import City from "./City";

export class Person {
  private originName: string;
  private name: string;
  city: City;

  constructor(_name: string) {
    makeAutoObservable(this);

    this.originName = _name;
    this.name = _name;
    this.city = new City('北京市');
  }

  setName(newName: string) {
    this.name = newName;
  }

  getName() {
    return this.name;
  }

  reset() {
    this.name = this.originName;
    this.city.reset();
  }
}

export default Person;
